﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace demo
{
    class DiagnosticObserver : IObserver<DiagnosticListener>, IObserver<KeyValuePair<string, object>>
    {
        public void OnCompleted()
        {

        }

        public void OnError(Exception error)
        {
            Console.WriteLine($"error: {error}");
        }

        public void OnNext(DiagnosticListener value)
        {
            value.Subscribe(this);
        }

        public void OnNext(KeyValuePair<string, object> value)
        {
            Console.WriteLine($"key: {value.Key}, value: {value.Value}");
        }
    }
}
